﻿/*********************************************************************************/
/**    Sims3Pack Readme Generator                                               **/
/**    Copyright (C) 2012  Anja Knackstedt                                      **/
/**                                                                             **/
/**    This program is free software: you can redistribute it and/or modify     **/
/**    it under the terms of the GNU General Public License as published by     **/
/**    the Free Software Foundation, either version 3 of the License, or        **/
/**    (at your option) any later version.                                      **/
/**                                                                             **/
/**    This program is distributed in the hope that it will be useful,          **/
/**    but WITHOUT ANY WARRANTY; without even the implied warranty of           **/
/**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            **/
/**    GNU General Public License for more details.                             **/
/**                                                                             **/
/**    You should have received a copy of the GNU General Public License        **/
/**    along with this program.  If not, see <http://www.gnu.org/licenses/>.    **/
/**                                                                             **/
/*********************************************************************************/




using System.Collections.Generic;

namespace Sims3PackReadmeGenerator.ContentDesciption
{
    /// <summary>
    /// sim specific information
    /// </summary>
    class PackagedSimDescription: PackagedFileDescription
    {
        #region fields

        private List<DescriptionItem> _traitList;       

        #endregion

        #region properties

        public string MetaName          { get; set; }
        public string MetaDescription   { get; set; }
        public string Bio               { get; set; }
        public string NumOfThumbs       { get; set; }
        public DescriptionItem Age      { get; set; }
        public DescriptionItem Species  { get; set; }
        public DescriptionItem Gender   { get; set; }
        public DescriptionItem FavColor { get; set; }
        public DescriptionItem FavMusic { get; set; }
        public DescriptionItem FavFood  { get; set; }
        public SimTypes SimType         { get; set; }
        public bool IsVampire           { get; set; }
        public bool IsUnicorn           { get; set; }
        public bool IsAnimal 
        {
            get
            {
                if (this.Species.DE != "Sim")
                {
                    return true;
                }
                return false;
            }            
        }

        #endregion

        #region constructor

        public PackagedSimDescription(PackagedFileDescription packFileDescr)
        {
            _traitList = new List<DescriptionItem>();

            this.Name   = packFileDescr.Name;
            this.Length = packFileDescr.Length;
            this.Offset = packFileDescr.Offset;
            this.Guid   = packFileDescr.Guid;
            this.ContentType = packFileDescr.ContentType;           

            this.Age        = new DescriptionItem();
            this.Species    = new DescriptionItem();
            this.Gender     = new DescriptionItem();
            this.FavColor   = new DescriptionItem();
            this.FavFood    = new DescriptionItem();
            this.FavMusic   = new DescriptionItem();

            this.IsVampire = false;
            this.IsUnicorn = false;
        }

        #endregion

        #region methods

        public void addTrait(DescriptionItem trait)
        {
            _traitList.Add(trait);
        }

        public string getMetaName()
        {
            return this.MetaName;
        }

        public string getSimDescription()
        {
            return this.MetaDescription;
        }

        public string getSimBio()
        {
            return this.Bio;
        }

        public string getSimAge(Languages lang)
        {
            string age = "";

            if (lang == Languages.de)
                age = this.Age.DE;
            else
                age = this.Age.EN;

            return age;
        }      

        public string getSimGender(Languages lang)
        {
            string gender = "";

            if (lang == Languages.de)
                gender = this.Gender.DE;
            else
                gender = this.Gender.EN;

            return gender;
        }

        public string getSimSpecies(Languages lang)
        {
            string species = "";

            if (lang == Languages.de)
                species = this.Species.DE;
            else
                species = this.Species.EN;

            return species;
        }

        public string getFavFood(Languages lang)
        {
            //only sims have favs
            if (this.SimType != SimTypes.sim)
                return "";

            //vampires have always o-positive
            if (this.IsVampire)
            {
                if (lang == Languages.de)
                    return "O-Positiv";
                else
                    return "O-Positive";
            }
            
            if (lang == Languages.de)
                return this.FavFood.DE;
            else
                return this.FavFood.EN;
        }

        public string getFavMusic(Languages lang)
        {
            //only sims have favs
            if (this.SimType != SimTypes.sim)
                return "";
            
            if (lang == Languages.de)
                return this.FavMusic.DE;
            else
                return this.FavMusic.EN;
        }

        public string getFavColor(Languages lang)
        {
            //only sims have favs
            if (this.SimType != SimTypes.sim)           
                return "";
            
            if (lang == Languages.de)
                return this.FavColor.DE;
            else
                return this.FavColor.EN;
        }

        public string getFavList(Languages lang)
        {
            //only sims have favs
            if (this.SimType != SimTypes.sim)           
                return "";           
            
            string display = "";

            if (lang == Languages.de)
                display = this.getFavFood(lang) + ", " + this.FavMusic.DE + ", " + this.FavColor.DE;
            else
                display = this.getFavFood(lang) + ", " + this.FavMusic.EN + ", " + this.FavColor.EN;

            return display;
        }

        public string getTraitList(Languages lang)
        {
            string display = "";

            if (lang == Languages.de)
            {
                foreach (DescriptionItem listItem in _traitList)
                {
                    display += listItem.DE + ", ";
                }
            }
            else
            {
                foreach (DescriptionItem listItem in _traitList)
                {
                    display += listItem.EN + ", ";
                }
            }

            //remove last comma and space
            if (display.Length > 2)
            {
                display = display.Substring(0, display.Length - 2);
            }

            return display;
        }       

        #endregion
    }

}
